import React from "react";
import { Outlet, useLocation } from "umi";
import { ConfigProvider } from "antd";
import Navbar from "@/components/Navbar";
import zhCN from "antd/es/locale/zh_CN";
import "./index.less";
import GFooter from "@/components/GFooter";

const Layout: React.FC = () => {
  const location = useLocation();

  // 判断当前路径是否为 "/tool/avatar"
  const isToolAvatarPage = location.pathname === "/tool/avatar";
  const isCv = location.pathname === "/cv";

  return (
    <ConfigProvider locale={zhCN}>
      <div className="navs">
        {/* 只有在不是 "/tool/avatar" 路由时才显示 Navbar */}
        {!isCv && <Navbar />}

        <Outlet />
        {/* 只有在不是 "/tool/avatar" 路由时才显示 Footer */}
        {!isToolAvatarPage && !isCv && <GFooter />}
      </div>
    </ConfigProvider>
  );
};

export default Layout;
